package com.fldx.baseboot.web.business.controller;

import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fldx.baseboot.common.annotation.Log;
import com.fldx.baseboot.common.core.controller.BaseController;
import com.fldx.baseboot.common.core.domain.AjaxResult;
import com.fldx.baseboot.common.enums.BusinessType;
import com.fldx.baseboot.web.domain.ComplaintsSuggestions;
import com.fldx.baseboot.web.business.service.IComplaintsSuggestionsService;
import com.fldx.baseboot.common.core.page.TableDataInfo;

/**
 * 信息收集Controller
 *
 * @author 范书铭
 * @date 2024-08-08
 */
@Api("信息收集Controller")
@RestController
@RequestMapping("/business/suggestions")
public class ComplaintsSuggestionsController extends BaseController {
    @Autowired
    private IComplaintsSuggestionsService complaintsSuggestionsService;

    /**
     * 查询信息收集列表
     */
    @ApiOperation(" 信息收集:列表")
    @PreAuthorize("@ss.hasPermi('business:suggestions:list')")
    @GetMapping("/list")
    public TableDataInfo list(ComplaintsSuggestions complaintsSuggestions) {
        startPage();
        List<ComplaintsSuggestions> list = complaintsSuggestionsService.selectComplaintsSuggestionsList(complaintsSuggestions);
        return getDataTable(list);
    }

    /**
     * 获取信息收集详细信息
     */
    @ApiOperation(" 信息收集:详细信息")
    @PreAuthorize("@ss.hasPermi('business:suggestions:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(complaintsSuggestionsService.selectComplaintsSuggestionsById(id));
    }

    /**
     * 新增信息收集
     */
    @ApiOperation(" 信息收集:新增")
    @PreAuthorize("@ss.hasPermi('business:suggestions:add')")
    @Log(title = "信息收集", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ComplaintsSuggestions complaintsSuggestions) {
        return success(complaintsSuggestionsService.insertComplaintsSuggestions(complaintsSuggestions));
    }

    /**
     * 修改信息收集
     */
    @ApiOperation(" 信息收集:修改")
    @PreAuthorize("@ss.hasPermi('business:suggestions:edit')")
    @Log(title = "信息收集", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ComplaintsSuggestions complaintsSuggestions) {
        return success(complaintsSuggestionsService.updateComplaintsSuggestions(complaintsSuggestions));
    }

    /**
     * 删除信息收集
     */
    @ApiOperation(" 信息收集:删除")
    @PreAuthorize("@ss.hasPermi('business:suggestions:remove')")
    @Log(title = "信息收集", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        complaintsSuggestionsService.deleteComplaintsSuggestionsByIds(ids);
        return success();
    }

}
